package com.aynu.bean;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;

import javax.validation.constraints.Email;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
//与指定文件值存入
//只有这个组件是容器中的组件，容器才能提供@@ConfigurationProperties功能
//@Component注册组件为容器
@Component
//将配置文件中的相关配置与本类绑定
@Validated
@ConfigurationProperties(prefix = "pic")
//@PropertySource(value = {"classpath:person.properties"})//指定配置文件
public class PictureDetail {
//    @Value("${person.email}")
//    @javax.validation.constraints.Email
//    private String Email;
    private PictureName pictureName;
    private String lead;//主角
    private int score;
    private Date birthday;
    private List<String>[] CharacterList;
    private Map<String,Object> commentMap;

    @Override
    public String toString() {
        return "PictureDetail{" +
                "pictureName=" + pictureName +
                ", lead='" + lead + '\'' +
                ", score=" + score +
                ", birthday=" + birthday +
                ", CharacterList=" + Arrays.toString(CharacterList) +
                ", commentMap=" + commentMap +
                '}';
    }

    public PictureName getPictureName() {
        return pictureName;
    }

    public void setPictureName(PictureName pictureName) {
        this.pictureName = pictureName;
    }

    public String getLead() {
        return lead;
    }

    public void setLead(String lead) {
        this.lead = lead;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public List<String>[] getCharacterList() {
        return CharacterList;
    }

    public void setCharacterList(List<String>[] characterList) {
        CharacterList = characterList;
    }

    public Map<String, Object> getCommentMap() {
        return commentMap;
    }

    public void setCommentMap(Map<String, Object> commentMap) {
        this.commentMap = commentMap;
    }
}
